//package com.wxq.workpad.lailiao
//
//import android.content.Context
//import android.content.Intent
//import android.os.Bundle
//import android.view.Gravity
//import android.view.LayoutInflater
//import android.view.View
//import android.widget.LinearLayout
//import android.widget.PopupWindow
//import androidx.recyclerview.widget.LinearLayoutManager
//import com.qianfan.qfcall.network.manager.HttpManager
//import com.qianfan.qfcall.network.requestResponseThrowException
//import com.samluys.statusbar.StatusBarUtils
//import com.sum.network.error.ApiException
//import com.wxq.workpad.finishproduct.ProductTestDetailActivity
//import com.wxq.workpad.R
//import com.wxq.workpad.adapter.LaiLiaoListAdapterOld
//import com.wxq.workpad.apiservice.PadApiService
//import com.wxq.workpad.base.BaseActivity
//import com.wxq.workpad.base.lifeRecycle
//import com.wxq.workpad.databinding.ActivityLaiLiaoBinding
//import com.wxq.workpad.entity.LaiLiaoItemEntity
//import com.wxq.workpad.utils.log.LogUtils
//import kotlinx.coroutines.Dispatchers
//import kotlinx.coroutines.GlobalScope
//import kotlinx.coroutines.launch
//
//class beiyongActivity : BaseActivity<ActivityLaiLiaoBinding>() {
//
//
//    private var status: String = ""
//    private lateinit var laiLiaoListAdapterOld: LaiLiaoListAdapterOld
//    private lateinit var mListData: MutableList<LaiLiaoItemEntity>
//
//    var page: Int = 1;
//    var oldPage: Int = 1;
//
//
//    override fun initData() {
//       showLoading()
//       getData()
//    }
//    fun getData() {
//        GlobalScope.launch(Dispatchers.Main) {
//            try {
//                var result = requestResponseThrowException {
//                    HttpManager.create(PadApiService::class.java).getTestList(page.toString(), "10",status)
//                }
//                if (result != null && result.records != null) {
//                    if (page == 1) {
//                        mListData.clear()
//                    }
//                    mListData.addAll(result.records)
//                    laiLiaoListAdapterOld.notifyDataSetChanged()
//                }
//            } catch (e: Exception) {
//                page = oldPage
//
//                if (e is ApiException) {
//                    showToast(e.errMsg)
//                } else {
//                    showToast(e.toString())
//                }
//            }finally {
//                binding.refreshLayout.finishRefresh()
//                binding.refreshLayout.finishLoadMore()
//                dismissLoading()
//            }
//        }.lifeRecycle(lifecycle)
//    }
//    override fun initView(instanceState: Bundle?) {
//        StatusBarUtils.transparencyBar(this@beiyongActivity)
//        StatusBarUtils.StatusBarIconDark(this@beiyongActivity)
//        binding.ivBack.setOnClickListener{
//            onBackPressed()
//        }
//
//
//        binding.llSingleState.setOnClickListener{
//
//            // 一个自定义的布局，作为显示的内容
//            val contentView: View = LayoutInflater.from(mContext).inflate(
//                R.layout.popupcontent, null
//            )
//            val popupWindow = PopupWindow(
//                contentView,
//                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true
//            )
//            popupWindow.isTouchable = true
//            popupWindow.isOutsideTouchable = true
//            val location = IntArray(2)
//            binding.llSingleState.getLocationOnScreen(location)
//
//            popupWindow.showAtLocation(
//                binding.llSingleState,
//                Gravity.NO_GRAVITY,
//           0,
//                location[1] +  binding.llSingleState.getHeight()
//            )
//            popupWindow.setOnDismissListener {
//                binding.zhezhao.visibility=View.GONE
//            }
//            binding.zhezhao.visibility=View.VISIBLE
//
//        }
//
//        LogUtils.e("当前数据" + status)
//        laiLiaoListAdapterOld = LaiLiaoListAdapterOld(mContext!!);
//        binding.rvContent.apply {
//            layoutManager = LinearLayoutManager(mContext!!, LinearLayoutManager.VERTICAL, false)
//            adapter = laiLiaoListAdapterOld
//        }
//        // 调接口获取数据
//        mListData = ArrayList()
//        laiLiaoListAdapterOld.updateDate(mListData)
//        laiLiaoListAdapterOld.setClickListener {
//            showToast("点击了" + it.toString())
//
//            ProductTestDetailActivity.newInstance(mContext!!, mListData.get(it).supplierName)
//        }
//        // 下拉刷新
//        binding.refreshLayout.setOnRefreshListener {
//            oldPage = page
//            page = 1
//            getData()
//        }
//        // 加载更多
//        binding.refreshLayout.setOnLoadMoreListener {
//            oldPage = page
//            page++
//            getData()
//        }
//
//    }
//
//
//
//    companion object {
//
//        @JvmStatic
//        fun newInstance(context: Context) {
//            val intent = Intent(context, beiyongActivity::class.java)
//            context.startActivity(intent)
//        }
//    }
//
//
//}